<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title> 3-2 通过ID获取元素</title>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <script type="text/javascript">

    </script>
</head>

<body>
<div align="center">
    <p><a href="../index.php#js" class="fontSize" title="点击进入该目录">目录</a></p>
</div>

<p id="con">JavaScript</p>
<script type="text/javascript">
    var mychar=document.getElementById("con");
        document.write("结果:"+mychar); //输出获取的p标签.
</script>

</body>
</html>
